package cn.edu.lingnan.controllerV1;


import cn.edu.lingnan.service.ExamDetailService;
import cn.edu.lingnan.user.dtos.Result;

import cn.edu.lingnan.user.pojos.PageBean;
import cn.edu.lingnan.user.vos.ExamDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/exam-detail")
public class ExamDetailController {

    @Autowired
    private ExamDetailService examDetailService;


    //管理员用
    // 分页查询考生的考试记录
    @GetMapping("/{userId}")
    public Result<PageBean<ExamDetailVO>> getExamDetailsByUserId(
            @PathVariable Integer userId,
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer pageSize
    ) {
        PageBean<ExamDetailVO> pageBean = examDetailService.getExamDetailsByUserId(userId, page, pageSize);
        return Result.success(pageBean);
    }
}
